<!DOCTYPE html>
<html class="x-admin-sm">
  <head>
    <meta charset="UTF-8">
    <title>demo</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="../../css/font.css">
    <link rel="stylesheet" href="../../css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="../../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../js/xadmin.js"></script>
    <script type="text/javascript" src="../../js/cookie.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a>
          <cite>订单列表</cite>
        </a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so">
          <div class="layui-input-inline">
            <select name="classify">
              <option value="">请选择单号类型</option>
              <option value="0">系统订单号</option>
              <option value="1">货物订单号</option>
            </select>
          </div>
          <input type="text" name="number"  placeholder="请输入订单号" autocomplete="off" class="layui-input">
          <button class="layui-btn"  lay-submit="" lay-filter="sreach" id="ss"><i class="layui-icon">搜索</i></button>
        </form>
      </div>
    </div>
    <table class="layui-hide" id="test" lay-filter="test"></table>
    <script type="text/html" id="barDemo">
      <a lay-event="edit" onclick="x_admin_show('订单详情','order-xiangqing.html')" href="javascript:;">订单详情</a>&nbsp;&nbsp;
      <a lay-event="tuihuo" onclick="x_admin_show('填写退货原因','order-tuihuo.html')" href="javascript:;">退货处理</a>
    </script>

    <!--订单列表拿到数据-->
    <script>
      layui.use('table', function(){
        var table = layui.table;
        table.render({
          elem: '#test'
          ,url:'/servletXq?func=tlist'
          ,cols: [[
            {field:'sys_no', width:150, title: '系统订单号'}
            ,{field:'goods_no', width:150, title: '货物订单号'}
            ,{field:'name', width:110, title: '收货人姓名'}
            ,{field:'tel', width:120, title: '收货人联系方式'}
            ,{field:'consignee_address', width:150, title: '收货人地址'}
            ,{field:'s_name', width:110, title: '配送员姓名'}
            ,{field:'s_tel', width:150, title: '配送员电话'}
            ,{field:'text', width:150, title: '备注信息'}
            ,{field:'wealth', width:200, title: '操作',toolbar: '#barDemo'}
          ]]
          ,page: true
        });
        //监听行工具
          table.on('tool(test)', function (obj) { //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
              var data = obj.data //获得当前行数据
                  , layEvent = obj.event; //获得 lay-event 对应的值
              if (layEvent === 'edit') {
                  $.ajax({
                      url:'/servletXq?func=login',
                      type:'get',
                      data:{'ddname':data.sys_no},
                      dataType:'json',
                      success:function (backData){
                          console.log(backData)
                          console.log(backData.status)
                      },
                      error:function (e){
                          console.log(e)
                      }
                  });
              }
          });
      });
    </script>

    <script>
      layui.use('laydate', function(){
        var laydate = layui.laydate;
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });
      });
    </script>
  </body>

</html>